Implement fallback for old draw_drawable vfunc
authorAlexander Larsson <alexl@redhat.com>
Tue, 11 Aug 2009 10:58:48 +0000 (12:58 +0200)
committerAlexander Larsson <alexl@redhat.com>
Tue, 11 Aug 2009 10:58:48 +0000 (12:58 +0200)
GdkDrawable->draw_drawback was replaced with a new vfunc
draw_drawback_with_src that is now called from gdk_draw_drawable.
However, some code seems to call the vfunc directly (see bug #591288),
so make it chain to the new call.

Note that such direct vfunc calls are a bad idea and won't work for all
cases.

gdk/gdkdraw.c

index 714753083b4224332bc3d4f47e2a43ffc092e5ff..8ab946479c3765bd073f86cecd5b8e0770dc3b9b 100644 (file)
@@ -61,6 +61,15 @@ static void         gdk_drawable_real_draw_pixbuf            (GdkDrawable  *draw
                                                              GdkRgbDither  dither,
                                                              gint          x_dither,
                                                              gint          y_dither);
+static void         gdk_drawable_real_draw_drawable          (GdkDrawable  *drawable,
+                                                             GdkGC        *gc,
+                                                             GdkDrawable  *src,
+                                                             gint          xsrc,
+                                                             gint          ysrc,
+                                                             gint          xdest,
+                                                             gint          ydest,
+                                                             gint          width,
+                                                             gint          height);
      
 
 G_DEFINE_ABSTRACT_TYPE (GdkDrawable, gdk_drawable, G_TYPE_OBJECT)
@@ -74,6 +83,7 @@ gdk_drawable_class_init (GdkDrawableClass *klass)
   klass->get_clip_region = gdk_drawable_real_get_visible_region;
   klass->get_visible_region = gdk_drawable_real_get_visible_region;
   klass->draw_pixbuf = gdk_drawable_real_draw_pixbuf;
+  klass->draw_drawable = gdk_drawable_real_draw_drawable;
 }
 
 static void
@@ -1506,6 +1516,31 @@ composite_565 (guchar      *src_buf,
     }
 }
 
+/* Implementation of the old vfunc in terms of the new one
+   in case someone calls it directly (which they shouldn't!) */
+static void
+gdk_drawable_real_draw_drawable (GdkDrawable  *drawable,
+                                GdkGC         *gc,
+                                GdkDrawable  *src,
+                                gint           xsrc,
+                                gint           ysrc,
+                                gint           xdest,
+                                gint           ydest,
+                                gint           width,
+                                gint           height)
+{
+  GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable_with_src (drawable,
+                                                            gc,
+                                                            src,
+                                                            xsrc,
+                                                            ysrc,
+                                                            xdest,
+                                                            ydest,
+                                                            width,
+                                                            height,
+                                                            src);
+}
+
 static void
 gdk_drawable_real_draw_pixbuf (GdkDrawable  *drawable,
                               GdkGC        *gc,